﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using points.Model;
using points.AppInfo;

namespace points
{
    public partial class CreateConsumerAccount : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int pkLocale = AppVars.locale["en_ca"].Pk;
            int pkCustType = AppVars.customer_type["consumer"].Pk;
            int fkCustomerStatusType = AppVars.customer_status_type["active"].Pk;

            DateTime now = DateTime.Now;
            Customer c = new Customer
            (
                0,
                now,
                now,
                "n",
                0,
                pkLocale,
                pkCustType,
                fkCustomerStatusType,
                this.txtUserid.Text,
                this.txtPassword.Text,
                this.txtSalutation.Text,
                this.txtNameFirst.Text,
                this.txtNameMiddle.Text,
                this.txtNameLast.Text,
                this.txtEmail.Text,
                this.txtWebsite.Text,
                "",
                0,
                0
            );

            c.Insert();

            lblResultsMsg.Text = "Successful Update";
            btnSubmit.Enabled = false;
        }
    }
}